package cn.zyl.demo.undertow;

import io.undertow.Undertow;
import io.undertow.util.Headers;

/**
 * UndertowSimpleServer类说明: undertow创建简单web服务器
 *
 * @author z.y.l
 * @version v1.0
 * @date 2020-09-02
 */
public class UndertowSimpleServer {
    public static void main(String[] args) {
        Undertow undertow = Undertow.builder().addHttpListener(8080,"localhost" ).setHandler(handler->{
            handler.getRequestHeaders().put(Headers.CONTENT_TYPE, "text/plain");
            handler.getResponseSender().send("Hello simple undertow server.");
        }).build();
        undertow.start();
        System.out.println("----迷你undertow服务器启动----");
    }
}
